package com.greyu.ysj.utils;

import java.util.Locale;
import java.util.ResourceBundle;

import javax.servlet.http.HttpServletRequest;

import com.greyu.ysj.config.Constants;

public class International {
	public static ResourceBundle getLanguage(HttpServletRequest request) {
		 String language=request.getHeader(Constants.LANGUAGE);
		 if(language==null) {
				language="language_zh"; 
		 }
		 String[]arr=language.split("_");
		 ResourceBundle myResourcesBundle = null;
		 if(arr[1].equals("zh")){
			 myResourcesBundle= ResourceBundle.getBundle("com.greyu.ysj.international.myresource",Locale.CHINA);
	     }
		 if(arr[1].equals("tw")){
			 myResourcesBundle= ResourceBundle.getBundle("com.greyu.ysj.international.myresource",Locale.TAIWAN);
	     }
		 if(arr[1].equals("ko")){
			 myResourcesBundle= ResourceBundle.getBundle("com.greyu.ysj.international.myresource",Locale.KOREA);
	     }
		 if(arr[1].equals("en")){
			 myResourcesBundle= ResourceBundle.getBundle("com.greyu.ysj.international.myresource",Locale.US);
	     }
		
		return myResourcesBundle;
	}
}
